package com.alander.nexusgo.framework.web.starter.controller;


import cn.dev33.satoken.stp.StpUtil;
import com.alander.nexusgo.common.response.Result;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BaseController {

    protected <T> Result<T> success() {
        return Result.success();
    }

    protected <T> Result<T> success(T data) {
        return Result.success(data);
    }

    protected <T> Result<T> fail(String message) {
        return Result.fail(message);
    }

    protected <T> Result<T> fail(Integer code, String message) {
        return Result.fail(code, message);
    }

    protected Long getUserId() {
        return StpUtil.getLoginIdAsLong();
    }

    protected boolean isLogin() {
        return StpUtil.isLogin();
    }
}
